package java_thinking.unit_17._17_9_10;

import java_thinking.net.mindview.util.TextFile;

import java.util.List;

/**
 * @Desc:   使用SimpleHashMap重复练习13
 * @author: cww
 * @DateTime: 2019/4/19 19:52
 */

public class E19_WordCounter3 {
    public static void main(String[] args) {
        List<String> words = new TextFile("test3.txt","\\W+");
        SimpleHashMap<String,Integer> hashMap = new SimpleHashMap<>();
        for (String s : words) {
            Integer freq = hashMap.get(s);
            hashMap.put(s,freq == null ? 1 : freq + 1);
        }
        System.out.println(hashMap);
    }
}
